<?php
	defined('_JEXEC') or die('Restricted access');
	//echo "path:".CUTEENGINE_UTILS_COMPONENTS_PATH;
	require_once(CUTEENGINE_BASE_COMPONENTS_PATH."base_display_component_class.php");
	require_once(CUTEENGINE_UTILS_COMPONENTS_PATH."page_importer_engine.php"); 
    
	//
    // t_search_and_result
    //
	class t_search_and_result extends t_base_display_component
	{	
		// constant
		// G
		const language_position_last = 1;
        // argoument field name
		const main_url_argument_component_where_values = "component_where_values";
        const main_url_argument_prefix = "prefix";
		// db component parameter name
		// M
        const main_query_component_source_data_query = "source_data_query";
        // F
		const first_query_repository_name = "first_query";
        const disable_search = "disable_search";      
        // S
		const search_input_label = "search_input_label"; 
		const search_input_example = "search_input_example"; 

        const specific_parameters_position_first_query_repository_name = 1;
		const specific_parameters_position_disable_search = 2;
		const specific_parameters_position_search_input_label = 3;
		const specific_parameters_position_search_input_example = 4;
        const specific_parameters_position_last = 5;
		// U
		const url_page_label = '@page_';
		

		// property
		// public	
		// C
		public $content_loader = null; //t_content_loader;
		public $current_page = 1;
		//public $current_parameter = null; //t_url_parameter
        // P
        public $page_importer_engine = null; //t_page_importer_engine
        //  R
        public $result_tag = false;
		public $rows_per_page = 10;
        // S
        public $search_tag = false;
		public $skipped_inserted_count = 0;
		// T
		public $total_rows = 50;
		// method
        
		// protected
		//C
		protected function create_tags_structure()
		{
            global $g_javascript_namespace;
   			global $g_ambient_namespace;

              	
            // javascript
// H
			$g_javascript_namespace->header_script_generator->add_method_to_a_class_with_content(
                get_class($this),"hide_example_tag",'a_tag_name,a_value',"
		var local_tag = this.html_tag(a_tag_name);
		var local_tag_example = this.html_tag(a_tag_name+'_example');
		
		if ((a_value == false) && (local_tag.value == ''))
		{
			local_tag_example.ce_extension.change_style('display','block'); 
		}
		else
		{
			local_tag_example.ce_extension.change_style('display','none'); 
		}	
		");
	
			// S
			$g_javascript_namespace->header_script_generator->add_method_to_a_class_with_content(
                get_class($this),"set_focus_tag",'a_tag_name',"
		var local_tag = this.html_tag(a_tag_name);
		local_tag.focus();
		");							
			// O
					
			
			$g_javascript_namespace->header_script_generator->add_method_to_a_class_with_content(
                get_class($this),"on_get_parm_ok",'a_req,a_last_request_index_executed',"
                if (a_req.request_index > a_last_request_index_executed)
                {
                    this.component_to_response.innerHTML = a_req.responseText;		
                }
		");		

	
		
			// url array
            $this->new_url_argument(self::main_url_argument_prefix,
				0); 
            $this->new_url_argument(self::main_url_argument_component_where_values."1",
				1); 
			$this->new_url_argument(self::main_url_argument_component_where_values."2",
				2);	
			$this->new_url_argument(self::main_url_argument_component_where_values."3",
				3);	
			$this->new_url_argument(self::main_url_argument_component_where_values."4",
				4);					
			
            //echo "create_tags_structure";
			if (! $this->main_tag)
			{
				//echo "OK";
                $this->main_tag = new t_base_tag(t_base_tag_type::btt_div,$this->name);
				$local_header_script_generator = $this->main_tag->header_script_generator;
				//
                $this->main_tag->include_child_str = true;
				$local_header_script_generator->add_style_sheet_property("#$this->name","left","5px");
				$local_header_script_generator->add_style_sheet_property("#$this->name","top","5px");
				//$local_header_script_generator->add_style_sheet_property("#$this->name","width","100px");
				$local_header_script_generator->add_style_sheet_property("#$this->name","height","100px");
                $local_header_script_generator->add_style_sheet_property("#$this->name",'position','fixed');
				$local_header_script_generator->add_style_sheet_property("#$this->name",'background-color','lightpink');
				$local_header_script_generator->add_style_sheet_property("#$this->name",'border','1px solid blue');
                //$this->main_tag->set_editing_tags(true);
				//$this->main_tag->add_text_to_include('Workly.it | Offerte di lavoro');
                // search tag
                $local_disable_search = $this->get_main_query_parameter_value(self::disable_search);
				
                if ($local_disable_search !== 'true')
                {
                    //echo "local_disable_search ooo:$local_disable_search";
					// serch 
					$this->search_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name.'_search');
					$this->tag_for_more_fields = $this->search_tag; /*non togliere*/
					$local_header_script_generator->add_style_sheet_property("#".$this->search_tag->name,"height","100px");
					//$local_header_script_generator->add_style_sheet_property("#$this->search_tag->name",'position','fixed');
					$local_header_script_generator->add_style_sheet_property("#".$this->search_tag->name,'background-color','lime');
					$local_header_script_generator->add_style_sheet_property("#".$this->search_tag->name,'width','100%');
					
					// input container tag
					/*$local_search_container = $this->search_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name.'_search_container');
					$local_search_container->class_name = $this->name . "_container_class";*/
					
					// input label tag
					/*$local_search_input_label = $local_search_container->create_and_add_child_at_bottom(t_base_tag_type::btt_label,$this->name.'_search_input_label');
					$local_input_label_text = $this->get_main_query_parameter_value(self::search_input_label);
					$local_search_input_label->add_text_to_include($local_input_label_text);
					$local_search_input_label->class_name = $this->name . "_input_label_class";*/
					/*// input tag
					$local_search_input = $local_search_container->create_and_add_child_at_bottom(t_base_tag_type::btt_input,$this->name.'_search_input');
					$local_search_input->add_property('type','text');
					$local_search_input->class_name = $this->name . "_input_class";
					$local_search_input->add_event_as_local_method($local_search_input->name,'onfocus',"hide_example_tag",$this->delayed_position,"'$local_search_input->name',true");
					$local_search_input->add_event_as_local_method($local_search_input->name,'onblur',"hide_example_tag",$this->delayed_position,"'$local_search_input->name',false");*/
					/*// example tag
					$local_search_input_example = $local_search_container->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name.'_search_input_example');
					$local_search_input_example_text = $this->get_main_query_parameter_value(self::search_input_example);
					$local_search_input_example->add_text_to_include($local_search_input_example_text);					
					$local_search_input_example->class_name = $this->name . "_input_example_class";
					$local_header_script_generator->add_style_sheet_property(".$local_search_input_example->name",'position','relative');
					$local_search_input_example->add_event_as_local_method($local_search_input_example->name,'onclick',"set_focus_tag",$this->delayed_position,"'$local_search_input->name'");*/
					// 
					$this->extended_search();
					//$local_search_input_label->add_property('for',$local_search_input->name);
                }    
                //add_sense_tag
                $this->add_sense_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name.'_add_sense');
				//result tag
				$this->result_tag = $this->main_tag->create_and_add_child_at_bottom(t_base_tag_type::btt_div,$this->name.'_result');
				$local_header_script_generator->add_style_sheet_property("#".$this->result_tag->name,"height","100px");
				//$local_header_script_generator->add_style_sheet_property("#".$this->result_tag->name,'position','fixed');
				$local_header_script_generator->add_style_sheet_property("#".$this->result_tag->name,'background-color','green');
				$local_header_script_generator->add_style_sheet_property("#".$this->result_tag->name,'width','100%');
                //
				
			}


		}
		// G
		public function get_language_position_last()
        {
            return self::language_position_last;
        }
        static function get_help_specific_parameter($a_index)
		{
			$local_return = 'NO HELP AVAILABLE';
			/*switch ($a_index) 
            {
                case self::specific_parameters_position_:
					$local_return = '';
				break;                
			}*/
			return $local_return;
		}
        static function get_default_specific_parameter($a_index)
		{
			$local_return = '';
			//echo "a_index: $a_index<br>";
			switch ($a_index) 
            {
                /*case self::specific_parameters_position_:
					$local_return = 'TRUE';
				break;                */
			}
			return $local_return;
		}	
        protected function get_specific_parameters_position_last()
        {
            return self::specific_parameters_position_last;
        }		
		// I
		protected function initialize_query_parameters()
		{
			 // db array parameter									
			$this->new_query_parameter(
				t_cuteengine_component::main_query_parameter_name,
				self::main_query_component_source_data_query,
				t_cuteengine_component::main_query_field_name_specific_parameters,
				1);
  			$this->new_query_parameter(
				t_cuteengine_component::main_query_parameter_name,
				self::disable_search,
				t_cuteengine_component::main_query_field_name_specific_parameters,
				2);
            $this->new_query_parameter(
				t_cuteengine_component::main_query_parameter_name,
				self::search_input_label,
				t_cuteengine_component::main_query_field_name_specific_parameters,
				3);    
			$this->new_query_parameter(
				t_cuteengine_component::main_query_parameter_name,
				self::search_input_example,
				t_cuteengine_component::main_query_field_name_specific_parameters,
				4); 
		}
		// public
		public function __construct($a_cuteengine_component,$a_query_parameter) 
		{
			global $g_javascript_namespace;
			$this->page_importer_engine = new t_page_importer_engine($this);
			$this->content_loader = new t_content_loader($g_javascript_namespace,$this);
			$this->content_loader->initialize_parameter('undefined',
				'undefined','undefined','this.on_get_parm_ok',
				'undefined','undefined',false);			
			parent::__construct($a_cuteengine_component,$a_query_parameter);
			$this->default_method = 'execute_search';		
            //echo "this->user_agent->browser:".$this->user_agent->browser;
            //if ($this->user_agent->browser ==  t_user_agent_component::t_browser_nn)
                //$this->rows_per_page = $this->total_rows;
                
            //echo "Construct <br>";
			
			
		}	

        // A
        public function add_page_argument($a_str,$a_page_no)
        {
            
			if ($a_page_no == 1)
				$this->remove_page_argument($a_str);
			else
			{
				$this->remove_page_argument($a_str);			
				$a_str = rtrim($a_str,"@") . self::url_page_label."$a_page_no";
			}	
			return $a_str;
        }
		
        public function create_pages() 
		{
			global $g_ambient_namespace;
			global $g_url_parameters_namespace;
			    
            //$local_parameters_list = $g_url_parameters_namespace;
			//$local_parameter = $g_url_parameters_namespace->get_parameter_by_component_id($this->id);
			$local_parameters_list = new t_url_parameters_list(false);
			$local_parameters_list->add_new_parameter(
                $this->id,$this->current_parameter->method,
                $this->current_parameter->argument,
                $this->current_parameter->request_type);
			$local_parameter = $local_parameters_list->get_parameter_by_component_id($this->id);
            $local_parameter->request_type = t_url_parameter::request_type_new_page/*_old_session*/;
            $local_url = $g_ambient_namespace->get_absolute_web_file_path(false);
			
			//	
            //echo "<br>this->total_rows: $this->total_rows - this->rows_per_page: $this->rows_per_page<br> ";
			$local_page_count = ceil(count($this->page_importer_engine->rows)/*$this->total_rows*/ / $this->rows_per_page);
            //echo "local_page_count: $local_page_count<br>";
			$local_pages_tag = $this->result_tag->create_and_add_child_at_bottom(
				t_base_tag_type::btt_div,"pages_container");
			$local_pages_tag->add_style_property("width",($local_page_count * 66)."px");
			//
			for($local_page_no = 1; $local_page_no <= $local_page_count; $local_page_no++)
			{
				$local_parameter->argument = $this->add_page_argument($local_parameter->argument,$local_page_no);
				$local_param = $local_parameters_list->compute_disguised_parameters_string();
				//echo "local_param: $local_param<br>";
				if ($local_param == '')
					$local_param = '-';
				//
				
				$local_page_tag = $local_pages_tag->create_and_add_child_at_bottom(
					t_base_tag_type::btt_a,"pages_no_".$local_page_no);
				$local_page_tag->add_text_to_include($local_page_no);
				if ($local_page_no == $this->current_page)
				    $local_page_tag->class_name = 'page_selected_class';
				else
				{
					$local_page_tag->class_name = 'page_class';
					$local_parameter_ad = $g_url_parameters_namespace->get_parameter_by_component_id(193); 
					if (isset($local_parameter_ad))
						$local_param = $local_param . 'c-193\\';
					$local_id = 203;
					$local_parameter_ad_2 = $g_url_parameters_namespace->get_parameter_by_component_id($local_id);
					if (isset($local_parameter_ad_2))
						$local_param = $local_param . 'c-'.$local_id.'\\';				
					/*$local_id = 229;
					$local_parameter_ad_2 = $g_url_parameters_namespace->get_parameter_by_component_id($local_id); 
					if (isset($local_parameter_ad_2))
						$local_param = $local_param . 'c-'.$local_id.'\\';
					$local_id = 226;
					$local_parameter_ad_2 = $g_url_parameters_namespace->get_parameter_by_component_id($local_id); 
					if (isset($local_parameter_ad_2))
						$local_param = $local_param . 'c-'.$local_id.'\\';
					$local_id = 230;
					$local_parameter_ad_2 = $g_url_parameters_namespace->get_parameter_by_component_id($local_id); 
					if (isset($local_parameter_ad_2))
						$local_param = $local_param . 'c-'.$local_id.'\\';
					$local_parameter_ad_2 = $g_url_parameters_namespace->get_parameter_by_component_id($local_id); */
					
					$local_page_tag->add_property("href",$local_url.$local_param);   
					/*$local_page_tag->add_event_as_local_method($local_page_tag->name,
						'onclick','jump_to_page',$this->delayed_position,$local_page_no);*/
				}		

			}
			
		}
// C
		public function create_internal_parts()
        {
			global $g_database_namespace;
            parent::create_internal_parts();
			//echo __METHOD__  . "<br>"
			// MAIN FORM
			//echo "this->get_destination() - " . $this->get_destination() ."<BR>";
   
            $this->form_part = $this->add_new_part(-1,1,t_form_part,'@'.$this->name.'_part@@@',"",
				//fields
				"@|t_field_lookup|".$this->name . "_input_field|-1|TRUE|".$this->get_main_query_parameter_value(self::search_input_label)."|".$this->get_main_query_parameter_value(self::search_input_example)."|false|false|@",
				// action 1
				''
                ,1); 
			/*t_base_action::create_action_from_string($this,$this->form_part,'["none","t_action_send_mail","'.$this->get_action_name().'",["'.
                $this->name.'_post","'.$this->get_field_form_name().'","'.$this->name.'_post"],"'.
				$this->get_main_query_parameter_value(self::specific_parameters_position_destination_name) .'","'.
				$this->get_main_query_parameter_value(self::specific_parameters_position_destination_domain).'","","","",""]');
 */
        }
		//D
	/*	public function display_component()
		{
			parent::display_component();
		}*/
		// E
		public function execute_component_action()
		{
			$local_function = parent::execute_component_action();
            //echo "local_function:$local_function";
			if ($local_function)
			{
				$this->$local_function();
            }
			else
			{
				 
			}
			//echo "argomento: ".$this->url_argument(self::main_url_argument_import_file_name);
			//$this->parse_source();
		}
		
		public function execute_search()
		{
			//echo "execute_search<br>";
			Global $g_url_parameters_namespace;
			global $g_ambient_namespace;
            global $g_javascript_namespace;
            $g_ambient_namespace->log->add_a_report_log("------>START ".__METHOD__);
            
			$local_parameter = $g_url_parameters_namespace->get_parameter_by_component_id($this->id);    
			
			//
			if ((isset($local_parameter) && ($local_parameter->argument != '')) || ($g_ambient_namespace->fast_parameter != ''))
			{
				//$g_ambient_namespace->log->add_log_error("g_ambient_namespace->fast_parameter: '".$g_ambient_namespace->fast_parameter."'");
			
				$g_ambient_namespace->log->add_a_report_log("--->START THE SEARCH");
				//echo $local_parameter->argument;
				$local_new_page = $this->remove_page_argument($local_parameter->argument);
				//echo "PRIMA - isset(this->current_parameter):".isset($this->current_parameter)."<br>";
				$local_is_new_parameter = (($local_parameter->is_equal_to($this->current_parameter) == false) /*||
					($local_parameter->request_type != t_url_parameter::request_type_new_page_old_session)*/);
				//echo "local_is_new_parameter: $local_is_new_parameter <BR>";
				if ($local_parameter->request_type === t_url_parameter::request_type_new_page)
                    parent::add_component_to_page_structure();
                if ($local_is_new_parameter)
				{
					$local_sql = $this->get_main_query_parameter_value(self::main_query_component_source_data_query);
					//
					$local_where_comune = $this->url_argument(self::main_url_argument_component_where_values."1");
					$local_where_provincia = $this->url_argument(self::main_url_argument_component_where_values."2");
					$local_where_regione = $this->url_argument(self::main_url_argument_component_where_values."3");
					$local_where_parole = $this->url_argument(self::main_url_argument_component_where_values."4");
					
					
					
					//$this->current_page = 1;
					//echo "local_where_parole: $local_where_parole - <br>";
					//
					$local_return = $this->parse_fast_parameter($local_where_comune,$local_where_provincia,
						$local_where_regione,$local_where_parole);

					//
					//print_r($local_return);
					$local_where_comune = $local_return[0];
					$local_where_provincia = $local_return[1];
					$local_where_regione = $local_return[2];
					$local_where_parole = $local_return[3];

					if (($g_ambient_namespace->fast_parameter != '') && ($local_where_regione != ''))
					{
						$local_parameter->request_type = t_url_parameter::request_type_new_page;
						$local_parameter->component_id = $this->id;
						$local_parameter->argument = "Lavoro@$local_where_comune@$local_where_provincia@$local_where_regione";
						//echo "local_where_regione: $local_where_regione";
					}			

					if ($g_ambient_namespace->fast_parameter !== '') 
					{
					  
						ob_end_clean();
					
						if ((trim($local_where_comune) === '') || (trim($local_where_provincia) === '') ||
							(trim($local_where_regione) === ''))
						{
							Header( "HTTP/1.1 410 Gone" ); 
							Header( "Location: http://www.workly.it"); 
						}
						else
						{
							Header( "HTTP/1.1 301 Moved Permanently" ); 
							Header( "Location: http://www.workly.it/c-24/Lavoro-$local_where_comune-$local_where_provincia-$local_where_regione-$local_where_parole/"); 
						}
						exit;
						
					}
					else
					{
						//
						$local_compute_sql_condition = $this->compute_sql_condition($this,$local_sql,$local_where_comune,
							$local_where_provincia,$local_where_regione,$local_where_parole);
						//print_r($local_compute_sql_condition);
						$local_where = $local_compute_sql_condition[1];
						//echo "local_compute_sql_condition: $local_compute_sql_condition $local_where";
						$local_sql = $local_compute_sql_condition[0];
						//echo "local_sql: $local_sql $local_where";
						$this->new_query(
							self::first_query_repository_name,$local_sql.$local_where,
							$g_ambient_namespace->connection);
						//
						$local_first_query = $this->get_query(
							self::first_query_repository_name);
							
						// sponsor_query	
						$local_sponsor_x_page = 3;		
						$local_pos = strpos($_SERVER["REQUEST_URI"],'page_');
						if ($local_pos === false)
							$local_page = 1;
						else
						{
						    $local_page = substr($_SERVER["REQUEST_URI"],$local_pos+5,10);
							$local_page = substr($local_page,0,strpos($local_page,'/'));
						}
						
						//echo 'call sponsor_select_offerte("'.$local_compute_sql_condition[2].'",'.($local_page-1) * $local_sponsor_x_page.','.$local_sponsor_x_page.')<br>';
						$this->new_query(
							'sponsor_query','call sponsor_select_offerte("'.$local_compute_sql_condition[2].'",'./*($local_page-1) * $local_sponsor_x_page*/0 .','./*$local_sponsor_x_page*/15 .')',
							$g_ambient_namespace->connection);
						//echo "local_page: ".$local_page."<br>";
						$local_sponsor_query = $this->get_query(
							'sponsor_query');
						 
						 
						//echo "3\n";
						$this->change_search_input_fields($local_where_comune,
							$local_where_provincia,$local_where_regione,$local_where_parole);
						$this->result_tag->clear_all_childs();
						$this->initialize_result_list();
						
						$local_read_from_db_and_rss = false;
						$this->page_importer_engine->clear();
						if ($local_read_from_db_and_rss)
						{
							//echo "pippo";
							// adds to page_importer_engine
							
							// FROM DB
							$local_function = "add_db_result_to_importer_engine";    

						}	
						else
						{
							$local_function = "add_db_result_to_importer_engine";				
						}
						//
						//echo "rows: ".count($this->page_importer_engine->rows)."<br>";
						$local_first_query->execute_function_from_query_result($this,$local_function,array($this,-1)); 
						$local_first_query->free_sql_result();
						//$this->page_importer_engine->order_by_date(5);
						//echo "rows: ".count($this->page_importer_engine->rows)."<br>";
						$this->skipped_inserted_count = 0;
						$local_sponsor_query->execute_function_from_query_result($this,$local_function,array($this,$local_sponsor_x_page)); 
						$local_sponsor_query->free_sql_result();
						//echo "rows: ".count($this->page_importer_engine->rows)."<br>";
						
					}
					//$local_first_query->sql_result_query->free_result();
                    $g_ambient_namespace->log->add_a_report_log("--->EXECUTED: $local_function FUNCTION");
					//
					if ($local_read_from_db_and_rss)
					{
						// FROM RSS
						$this->add_rss_result_to_importer_engine($local_where_comune,
							$local_where_provincia,$local_where_regione,$local_where_parole);
						$g_ambient_namespace->log->add_a_report_log("--->EXECUTED: add_rss_result_to_importer_engine FUNCTION");			
					}
				}
				else
				{
					$this->result_tag->clear_all_childs();
				
				}
                $local_first_row_index = ((($local_new_page - 1) * $this->rows_per_page));
                $local_total_rows = count($this->page_importer_engine->rows)/*$this->total_rows*/;
                if (($local_total_rows-1) < $local_first_row_index)
                    $local_new_page = floor(($local_total_rows-1) / $this->rows_per_page)+1;
				$this->current_page = $local_new_page;
                if ($this->current_page > 1)
                {
                    $g_javascript_namespace->header_script_generator->add_meta_tag('robots','','noindex,nofollow');
                }
                $this->generate_result_list_from_importer_engine($this);
				$this->current_parameter = $local_parameter;
				$this->create_pages();
                $this->generate_bottom_code($this,$local_where_comune,
					$local_where_provincia,$local_where_regione,$local_where_parole);
				// results
				if ($local_parameter->request_type === t_url_parameter::request_type_no_page)
				{
					echo $this->result_tag->generate_childs_html_code();
				}
				
                //echo "DOPO - isset(this->current_parameter):".isset($this->current_parameter)."<br>";
				
			}
            else            
            {
				$g_ambient_namespace->log->add_a_report_log("--->NOTHING TO SEARCH");
                $this->initialize_result_list();
                parent::add_component_to_page_structure();
            }
            $g_ambient_namespace->log->add_a_report_log("------>STOP ".__METHOD__);
		}		
		// F
		public function finalize_creation_component()
        {   
			global $g_cuteengine;
			global $g_url_parameters_namespace;
			parent::finalize_creation_component();
			
			$local_input = $this->search_tag->get_child_by_name($this->name . "_input_field");
			//echo "local_input->name: $local_input->name <br>";
			$local_parameter = $g_url_parameters_namespace->get_parameter_by_component_id($this->id);   
			
			if ((isset($local_parameter) && ($local_parameter->argument != '')) || ($g_ambient_namespace->fast_parameter != ''))
			{
				$local_original_argument = $local_parameter->argument;
				//echo $local_parameter->argument;
				$this->remove_page_argument($local_parameter->argument);
				$local_where_parole = $this->url_argument(self::main_url_argument_component_where_values."4");
				if ($local_where_parole != '')
				{
					$local_input_example = $this->search_tag->get_child_by_name($this->name.  "_input_field_example");
					//
					$local_input->add_property('value',rawurldecode($local_where_parole));
					$local_input_example->add_style_property('display','none');
				}
				else
				{
					$local_input->add_property('value','');
				}
				$local_parameter->argument = $local_original_argument;
			}
			else
			{
				$local_input->add_property('value','');
			}
		}
        // R
        public function remove_page_argument(&$a_parameter)
        {
            //echo "a_parameter:$a_parameter - ";
			if (strpos($a_parameter,self::url_page_label) !== false)
			{
				$local_extract = substr($a_parameter,strpos($a_parameter,self::url_page_label)); 
				//echo "local_extract:$local_extract - ";
				$a_parameter =  str_replace($local_extract,"",$a_parameter);
				//echo "a_parameter:$a_parameter - ";
				$local_result = substr($local_extract, strlen(self::url_page_label));
				//echo "local_result:$local_result<br>";
				if (! is_numeric($local_result))
					$local_result = 1;
				
			}
			else
				$local_result = 1;
            
			return $local_result;
        }
        
	}
?>